package goleetcode

import (
	"math"
	"sort"
)

func minimumAverage(nums []int) float64 {
	sort.Ints(nums)
	res, n := math.MaxFloat64, len(nums)
	for i := 0; i < n; i++ {
		res = min(res, float64(nums[i] + nums[n - 1 - i]) / 2)
	}
	return res
}